package generic;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhangxin
 * @date 2020/9/27
 */
public class ListTest {

    public static void main(String[] args) {


        Person person = new Person();
        Person student = new Student();
        List<? extends Person> list = new ArrayList<>();

        Person person1 = list.get(1);

        list.add(null);

        List<? super Person> list2 = new ArrayList<>();
        list2.add(person);
        list2.add(student);
        Object object = list2.get(1);

        System.out.println(object);
    }
}
